package com.hdoit.jiayuntong.data;

import java.util.ArrayList;
import java.util.List;

import com.hdoit.jiayuntong.entity.LocalPictureSelectedStatus;
import com.hdoit.jiayuntong.entity.Picture;

import android.content.Context;
import android.database.Cursor;
import android.provider.MediaStore;

public class LoadLocalImage {
	
    public static List<Picture> getLocalImage(Context context){
    	List<Picture> pics = new ArrayList<Picture>();
    	Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null, null, null, null);
    	while(cursor.moveToNext()){
    		Picture pic = new Picture();
    		pic.status = LocalPictureSelectedStatus.Unselected;
    		pic.setFilePath(cursor.getString(cursor.getColumnIndex("_data")));
    		pics.add(pic);
    	}
    	cursor.close();
    	return pics;
    }
}
